<template>
  <div class="rights-contaienr">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="rights-main">
      <el-table
        :data="jurisdictionList"
        style="width: 100%; margin-top: 16px"
        border
        max-height="600px"
      >
        <el-table-column label="#" width="50" type="index"></el-table-column>
        <el-table-column prop="authName" label="权限名称"> </el-table-column>
        <el-table-column prop="path" label="路径"> </el-table-column>
        <el-table-column label="权限等级">
          <template slot-scope="scope">
            <div>
              <el-tag :type="rankColorsArray[scope.row.level]">
                {{ scope.row.level | rank }}
              </el-tag>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { getUsersJurisdictionListApi } from '@/http/api.js'
export default {
  name: 'RightsView',
  components: {},
  data() {
    return {
      jurisdictionList: [],
      rankColorsArray: {
        // 权限类型
        0: '',
        1: 'success',
        2: 'danger'
      }
    }
  },
  created() {
    this.getUsersJurisdictionList()
  },
  mounted() {},
  methods: {
    async getUsersJurisdictionList() {
      const response = await getUsersJurisdictionListApi()
      this.jurisdictionList = response
    }
  }
}
</script>

<style scoped lang="scss">
.rights-contaienr {
  .rights-main {
    background-color: #fff;
    width: 100%;
    height: 100%;
  }
}
</style>
